package com.cy.pj.notice.dao.impl;


import com.cy.pj.notice.dao.SysNoticeDao;
import com.cy.pj.notice.pojo.SysNotice;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class SysNoticeDaoImpl implements SysNoticeDao {

    @Autowired
    private SqlSession sqlSession;

    public String getStatement() {//获取并返回方法全路径
        String interfaceName = this.getClass().getInterfaces()[0].getName();
        String methodName = Thread.currentThread().getStackTrace()[2].getMethodName();
        return interfaceName + "." + methodName;
    }

    @Override
    public List<SysNotice> selectNotices(SysNotice notice) {
        String statement = getStatement();
//        "com.cy.pj.notice.dao.SysNoticeDao.selectNotices"
        List<SysNotice> list = sqlSession.selectList(statement, notice);
        return list;
    }

    @Override
    public int deleteNotice(Long... id) {
        return 0;
    }

    @Override
    public int insertNotice(SysNotice notice) {
        return 0;
    }

    @Override
    public SysNotice findById(Long id) {
        return null;
    }

    @Override
    public int updataNotice(SysNotice notice) {
        return 0;
    }
}
